<?php
include_once 'user/user.class.php';
global $_SGLOBAL;

$_SGLOBAL['usepath']=0;
$_SGLOBAL['is_login']=0;


/* dump($_SGLOBAL);
dump($_REQUEST); */


$user = user::getuser("user");

$uid = $user;
if($uid>0){
	$_SGLOBAL['user'] = user::getuserinfo();
	$_SGLOBAL['uid'] = $user;
	$welcome = user::getuserinfo();
	 $vhl = user::getvhl();
	
	if(count($welcome['vhlList'])>1 && empty($vhl)){
		header("Location:".url("user/login/checkVhl"));
	}elseif(count($welcome['vhlList'])==1){
		user::savevhl($welcome['vhlList'][0]['vin']);
		$_SGLOBAL['vincode']=$welcome['vhlList'][0]['vin'];
		$_SGLOBAL['vhllist']=$welcome['vhlList'];
	}elseif(isset($vhl)){
		$_SGLOBAL['vincode']=$vhl;
		$_SGLOBAL['vhllist']=$welcome['vhlList'];
	}elseif(empty($vhl)){
			showEror("账号异常，请重新登录!",url("user/user/logout"));
	}
	
	if(isset($_GET['service'])){
		header("Location:".urldecode($_GET['service']));
	}
}else{

	echo '<script type="text/javascript">parent.location.href="'.url("user/login/showlogin",array('service'=>getlasturl())).'";</script>';
}